#!/usr/bin/env bash

set -Eeuxo pipefail

FILE="${1}"
FORMAT="$(bash inspect.sh "${FILE}")"

printf "%s\n" "Extracting audio from ${FILE} in format ${FORMAT} ..."
ffmpeg -i "${FILE}" -vn -acodec copy "${FILE%.*}.${FORMAT}" # $(echo "${FILE}" | rev | cut --fields '2-' --delimiter '.' | rev)
printf "Done.\n"
